import {message} from 'antd';
export const beforeUpload = function (file) {
  const isJPG = file.type === 'image/jpeg'||file.type === 'image/png'||file.type ==='image/jpg'||file.type ==='image/bmp';
  console.log(file)
  const isLt2M = file.size / 1024 / 1024 < 2;
  if (!isJPG) {
    message.error('请上传正确的图片格式');
    return isJPG
  }
  if (!isLt2M) {
    message.error('图片需要小于 2MB!');
  }
  return isJPG && isLt2M;
}